#ifndef POLYGONCREATEACTION_H
#define POLYGONCREATEACTION_H

#include "Common/Algebra/Transform.h"
#include "EditorCore/IProvider.h"
#include "EditorCore/Actions/Action.h"
#include "Entities/BodyEntity.h"
#include "Entities/PolygonEntity.h"

class PolygonCreateAction : public editor_core::Action, public editor_core::IProvider<PolygonEntity*>
{
public:
	PolygonCreateAction( const cmn::Transform& position, editor_core::IProvider<BodyEntity*>* parentBodyProvider );
	virtual ~PolygonCreateAction();

	virtual inline editor_core::ActionType GetType() const { return editor_core::ActionType::Undoable; }

	virtual inline PolygonEntity* GetEntity() { return m_polygonEntity; }

protected:
	virtual bool Commit();
	virtual void Recommit();
	virtual void Rollback();

private:
	cmn::Transform m_position;

	editor_core::IProvider<BodyEntity*>* m_parentBodyProvider;
	PolygonEntity* m_polygonEntity;
};

#endif
